import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import {Subject} from "rxjs";

@Injectable()

export class MemberService{
      constructor(private http:HttpClient){}

      // getsevice():void {
      //
      //   return this.http.get('./assets/data.json')
      // }

      // getsevice():void {
      //
      //   return this.http.get('./assets/data.json')
      //     .toPromise()
      //     .then( res =>  {
      //       console.log('first res', res)
      //     })
      //     // .then( res => { return res })
      //     .catch( err => { return err})
      // }

      public testSubject = new Subject<any>();

      getsevice():void {
        this.http.get('./assets/data.json')
          .subscribe(
            res => {
              this.testSubject.next(res)
            },
            err => {
              this.testSubject.next(err)
            }
          )
      }
}
